<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        #big{
            width: 600px;
            height: 700px;
            background-color: pink;
            position: absolute;
        }
    </style>
</head>
<body>
    <div id="big" class="big"></div>
</body>
<script>
    var big=document.getElementById("big");
    document.onkeydown=function(event){
        //alert("我是大的")
    var code=event.keyCode;
    switch(code){
        case 37:
            alert("左")
            break;
        case 38:
            alert("上")
        break;
            case 39:
            alert("右")
        break;
            case 40:
            alert("下")
            break;
            default:
            alert("请输入方向")
    }
    }
</script>
</html>